package com.java.al.net;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class sampletest  {
	public sampletest() {

	}

	public static void searchPort() {
		System.out.println("�����Ѿ�ʹ���˶˿ڣ�");
		for (int i = 1; i < 25600; i++) {
			try {
				InetAddress localHost = InetAddress.getLocalHost();
				InetAddress localHost1 = InetAddress.getByName("172.17.193.154");
				Socket socket = new Socket(localHost1, i);
				System.out.println(socket.getInetAddress() + "  " + i + ":ʹ��");
			} catch (UnknownHostException e) {
				// e.printStackTrace();
			} catch (IOException e) {
				System.out.println("  " + i + ":����");
			}
		}
		System.out.println("ִ����ϣ�");

	}

//	public void run() {
//		for (;;) {
//			// try {
//			// Thread.sleep(0);
//			this.searchPort();
//			// } catch (InterruptedException e) {
//			// TODO Auto-generated catch block
//			// e.printStackTrace();
//			// }
//		}
//		// TODO Auto-generated method stub
//
//	}

	public static void main(String[] args) {
		// Runnable rb = new sampletest();
		// new Thread(rb).start();
		sampletest.searchPort();
	}
}